package com.fdm.controller;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import org.apache.log4j.Logger;

public class BankLogFilter implements Filter {

	@Override
	public void destroy() {
		
	}

	@Override
	public void doFilter(ServletRequest servletRequest, 
			ServletResponse servletResponse,
			FilterChain filterChain) throws IOException, ServletException {

		filterChain.doFilter(servletRequest, servletResponse);
		String logContent = (String) servletRequest.getAttribute("message");
		Logger logger = Logger.getRootLogger();
		logger.info(logContent);
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		
	}
}
